//
//  IRTCSDK.h
//  ivcs_ios_demo
//
//  Created by zealcomm user on 2020/10/24.
//  Copyright © 2020 zealcomm user. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import <IRTC/IRTC.h>

#import "MediaStreamSettingOptions.h"
NS_ASSUME_NONNULL_BEGIN

@protocol IRTCSDKDelegate <NSObject>

/// 房间有流需要渲染，已存在的流/新增的流
/// @param label 流标签
-(void)onStreamAddWithLabel:(NSString *)label;

/// 房间的流结束
/// @param label 流标签
-(void)onStreamRemoveWithLabel:(NSString *)label;

@end


@interface IRTCSDK : NSObject

declareSingleInstance()

@property(strong , nonatomic)NSString *lastAiAgentVideoLabel;
// 标签和流的健值对
@property(strong , nonatomic)NSMutableDictionary *labelAndStreams;

@property (nonatomic,weak) id<IRTCSDKDelegate> delegate;

/// selfId in mcu room
@property(nonatomic,copy)NSString *participantId;

/// 加入room
/// @param token roomToken
/// @param success 成功，返回房间信息
/// @param failure 失败
-(void)joinRoomWithToken:(NSString *)token
                 onSuccess:(void (^)(IRTCConferenceInfo *info))success
                 onFailure:(void (^)(NSError *error))failure;



/// 推送本地流到mcu
/// @param label 流标签
/// @param options 推送参数
/// @param success 成功
/// @param failure 失败
-(void)publishLocalStreamToRoomWithStreamLabel:(nullable NSString *)label
                     mediaStreamSettingOptions:(MediaStreamSettingOptions *)options
                     onSuccess:(void (^)(IRTCLocalCameraStream *localStream,IRTCConferencePublication *publication))success
                                     onFailure:(void (^)(NSError *error))failure;
/// 推送本地分享流
/// @param label 流标签
/// @param options 推送参数
/// @param success 成功
/// @param failure 失败
-(void)publishShareStreamToRoomWithStreamLabel:(NSString *)label mediaStreamSettingOptions:(MediaStreamSettingOptions *)options onSuccess:(void (^)(IRTCLocalCameraStream * _Nonnull, IRTCConferencePublication * _Nonnull))success onFailure:(void (^)(NSError * _Nonnull))failure;
-(void)endShareStream;

/// 订阅远端流
/// @param label 流标签
/// @param remoteStream 远端流对象
/// @param success 成功
/// @param failure 失败
-(void)subscribeStreamWithLabel:(nullable NSString *)label
                IRTCRemoteStream:(IRTCRemoteStream *)remoteStream
                onSuccess:(void (^)(IRTCConferenceSubscription *subscription))success
                onFailure:(void (^)(NSError *error))failure;

/// 切换摄像头
- (void)switchCameraOnSuccess:(nullable void (^)(void))onSuccess onFailure:(nullable void (^)(NSError * _Nonnull))onFailure;



/// 离开房间
/// @param onSuccess 成功
/// @param onFailure 失败
-(void)leaveRoomSuccess:(void (^)(void))onSuccess
                onFailure:(void (^)(NSError *error))onFailure;



/// 停止本地视频的声音/视频画面推送
/// @param type audio/video
/// @param onSuccess 成功
/// @param onFailure 失败
-(void)muteWithMediaType:(IRTCTrackKind)type
            onSuccess:(void (^)(void))onSuccess
            onFailure:(void (^)(NSError *error))onFailure;


/// 恢复本地视频的声音/视频画面推送
/// @param type audio/video
/// @param onSuccess 成功
/// @param onFailure 失败
-(void)unmuteWithMediaType:(IRTCTrackKind)type
            onSuccess:(void (^)(void))onSuccess
            onFailure:(void (^)(NSError *error))onFailure;

-(CGSize)getVideoSizeByVideoLabel:(NSString *)videoLabel;
-(void)getSnapShotImage:(void (^)(UIImage*))onSuccess onFailure:(void (^)(NSError*))onFailure;
/// 获取截图
/// @param onSuccess 成功回调
/// @param onFailure 失败
-(void)getCustomerSnapShotImage:(void (^)(UIImage*))onSuccess onFailure:(void (^)(NSError*))onFailure;
@end

NS_ASSUME_NONNULL_END
